/**
 * 
 */
package partage;

import java.io.*;
/**
 * @author Ben
 *
 */
public class Login implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 3805299094791727692L;
	private String pseudo;
	private String motPasse;
	/**
	 * @param pseudo
	 * @param motPasse
	 */
	public Login(String pseudo, String motPasse) {
		this.pseudo = pseudo;
		this.motPasse = motPasse;
	}
	/**
	 * 
	 */
	public Login() {
		this.pseudo = null;
		this.motPasse = null;
	}
	/**
	 * @return the pseudo
	 */
	public String getPseudo() {
		return pseudo;
	}
	/**
	 * @param pseudo the pseudo to set
	 */
	public void setPseudo(String pseudo) {
		this.pseudo = pseudo;
	}
	/**
	 * @return the motPasse
	 */
	public String getMotPasse() {
		return motPasse;
	}
	/**
	 * @param motPasse the motPasse to set
	 */
	public void setMotPasse(String motPasse) {
		this.motPasse = motPasse;
	}
	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	public static Login valueOf(String login){
		if(login.indexOf("Login")>=0){
			String chaine=login.replaceAll("Login : pseudo = ", "");
			return new Login(chaine,null);
		}
		return null;
	}
	public boolean equals(Object obj) {
		Login other = (Login) obj;
		System.out.println(obj);
		System.out.println("Login.equals()" + this);
		if (!motPasse.equals(other.motPasse))
			return false;
		if (!pseudo.equals(other.pseudo))
			return false;
		return true;
	}
	public String toString() {
		return "Login : pseudo = " + pseudo;
	}
}
